home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2000-07-01 | 13.4 KB | 403 lines | [ SMAC/NISI]
//Clear clipboard 1, for use in loop to accumulate addresses 1 Clipboard = "" 0 //Open the Catalog or make sure it si open Show Catalog //Start at the beginning Jump "1" //Select the first file name Find Next "^.+" "g-WT" Loop: //Copy it to clipboard 9 Copy "9" '&' //Open the file Key //Begin the Get Addresses part //Which collects addreses from the //currently open document and accumulates them //in current clipboard //First, remove detailed headers which are now at the end. Jump "1" Replace All "^____________________Remaining Header Details____________________:.+" "" "-o-OSAi-wt-Gg" //Find All Addresses Find All "[0-9A-z_\-.]+\@[0-9A-z.\-]+\.[A-Za-z][A-Za-z][A-Za-z]-" "gt" //Put the starts and ends of the selection offsets on a stack StackOfEdresses->push (StartEnds) //Clear clipboard 1, for use in loop to accumulate addresses //Now for the loop where each address is selected //then copied to current clipboard (1) //then a return is added to the clipboard BeginLoop: //First check if anything left in the stack if (Not(StackOfEdresses->size)) GoTo FinishDocument //Pop the last two offsets and use them //to select the next eddess from the end SetSelect(StackOfEdresses->pop, StackOfEdresses->pop) //Append to clipboard 1 and add return Copy "1" Copy "1" '\r' GoTo BeginLoop FinishDocument: //End of collecting addresses for the current //document. Close Key D Find Next '\C9' Find Next "^.+" "g-Wt" If (Not(NumFound)) GoTo Finish GoTo Loop Finish: //Open New File for the Eddresses. New "Collected Addresses" Paste "1" //Begin sorting and removing of duplicates Select All lowercase Sort Paragraphs Jump "1" //This expression replaces all repeated paragraphs //with just one instance. On very long lists this may cause //an error message “There was an error in searching.” //If this happens, increase memory allocation to Nisus Writer //and run the expression again. Replace All "^\(.+\r\)\1+" "\1" "gt" //Checks the sequence of letters past the //last period in the email addresses (or urls) //listed in the active window. (each email //address must be in its own paragraph or //line) Selects all those which have a correct //ending, then reverses the selection, thus //selecting the illegal email addresses (or //urls) //and cuts that, then opens a new file named //"Bad Domains" and pastes the list of bad //addresses. Jump "1" Find All "^[^ @\s]+@.:+:(\.AD|\.AE|\.A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\.TC|\.TD|\.TF|\.TG|\.TH|\.TJ|\.TK|\.TM|\.TN|\.TO|\.TP|\.TR|\.TT|\.TV|\.TW|\.TZ|\.UA|\.UG|\.UK|\.UM|\.US|\.UY|\.UZ|\.VA|\.VC|\.VE|\.VG|\.VI|\.VN|\.VU|\.WF|\.WS|\.YE|\.YT|\.YU|\.ZA|\.ZM|\.ZR|\.ZW|\.COM|\.EDU|\.GOV|\.INT|\.MIL|\.NET|\.ORG|\.ARPA|\.NATO|:d:d-:d-\.:d:d-:d-\.:d:d-:d-\.:d:d-:d-:)\s*:(\r|:e:)" "g" Select Inverse If (SelectStart == SelectEnd) GoTo Finish Cut New "Bad Domains" Paste Exit Finish: :1 "No Bad Domains" //Find All Addresses Find All "[0-9A-z_\-.]+\@[0-9A-z.\-]+\.[A-Za-z][A-Za-z][A-Za-z]-" "gt" //Put the starts and ends of the selection offsets on a stack StackOfEdresses->push (StartEnds) //Clear clipboard 1, for use in loop to accumulate addresses 1 Clipboard = "" //Now for the loop where each address is selected //then copied to current clipboard (1) //then a return is added to the clipboard BeginLoop: //First check if anything left in the stack if (Not(StackOfEdresses->size)) GoTo Finish //Pop the last two offsets and use them to select the last eddess SetSelect(StackOfEdresses->pop, StackOfEdresses->pop) Copy Copy "" '\r' GoTo BeginLoop Finish: //Open New File for the Eddresses. New "Collected Addresses" MacroPaste 0 Replace In Selection "^" ">" "gt" //Replace all Returns with a space. //Returns are ignored in HTML. Replace All "\r" " " "gt" //Replace all multiple white space with one space. Replace All ":b:b+" " " "gt" //Now replace all break and paragraph tags //with a Return. Replace All "<br>|<p>" "\r" "gt" //Replace a sequence of special symbol codes //with the corresponding symbol Replace All """ """" "t" Replace All "©" "©" "gt" Replace All "¨" "®" "gt" //Replace the non-breaking space with a space Replace All "\ " " " "gt" //Replace all tags with a return, as each tag //most likely, though not always, represents //a change in format. Replace All "<[^>]+>|\|" "\r" "tg" //Now clean-up Replace All ":b*\r:b*\r:b*:(\r:b*:)+" "\r" "gt" Replace All "^[.,:;\s\t]*" "" "gt" Replace All "\&\#:d+;" "" "gt" //This macro first replaces multiple blanks //with a tab,then removes all blanks at the //beginnings of paragraphs. It then removes //all returns which are not preceeded by a //return or an end of sentence or a colon. //This seems to work well for all emails Find/Replace "^:b:b+:>[0-9]" "\t" "tgaA" Find/Replace ":b+$" "" "tgaA" Find/Replace ":<[^.?!:\r]\r:>[^•\r0-9\t]" " " "tgaA" Find/Replace ":b:b+" " " "tgaA" Replace In Selection "^>+" "" "gt" Replace All "\(^>+.+\r-\)+\r\r" """\1""\r\r" "gt" Replace All "^\(""\)->" "\1" "gt" Jump "1" //Change to clipboard 3 and clear it 3 Clipboard = "" //First pick-up any attachment information, if there to clip 3. Find Next "X\-Attached\:.*\:\([^:]+\)$" "gt" if (Not(NumFound)) GoTo AttachBypass Copy "3" ' and attached the file "\1"\r' AttachBypass: //First, remove detailed headers which are now at the end. Jump "1" Replace All "^____________________Remaining Header Details____________________:.+" "" "-o-OSAi-wt-Gg" //Then, collect Attribution information on Clipboard 1. //Switch to Clipboard 1 1 //Set clipboard to text in case there is no date field //then then get the date, if it’s there. Clipboard = "On an unknown date " Find Next "^Date\:\(.*\)$" "oOSAi©-wt-Gg" //If no date field by-pass getting it. if (Not(NumFound)) GoTo NoDateBypass Copy "" 'On \1 ' //Now remove the date field. Jump "1" Find/Replace "^Date\:.+\r" "" "oOSAi©-wt-Gg" NoDateBypass: //Get the from field. Jump "1" Find Next "^From\:\s*\([^<>@]+\)[^\s\t]+\s*$" "oO-S-Ai-wt-Gg" if (Not(NumFound)) GoTo NoFromBypass Copy "" '\1 wrote to ' GoTo FromAdded NoFromBypass: Clipboard = Clipboard + "someone wrote to " FromAdded: Jump "1" Find Next "^To\:\s\(.+\)" "oO-S-Ai-wt-Gg" Copy "" '\1' //Remove the old “to” Jump "1" Find/Replace "^To\:.+\r" "" "oO-S-Ai-wt-Gg" Jump "1" //ReplyTo Pickup if it exists Find Next "^Reply\s-\--\s-to\:\(.+\)" "oO-S-Ai-wt-Gg" If (Not(NumFound)) GoTo NoReplyField //Copy Reply-to field to clipboard 2 Copy "2" '\1\r' //Remove the Reply To field Jump "1" Find/Replace "^Reply\s-\--\s-to\:\(.+\)\r" "" "oO-S-Ai-wt-Gg" 2 Jump "1" Key To: MacroPaste 1 //Remove the From field Find/Replace "^From\:.+\r" "" "oO-S-Ai-wt-Gg" GoTo Bypass NoReplyField: //Then, switch “from” to “to”. Find/Replace "^From" "To" "gt" if (NumFound) GoTo Bypass :1 "There seems to be no return address." Bypass: //Then “cc” removed Find/Replace "^cc\:.+\r" "" "gt" Select All //Make sure all text color is black. Black Replace All "^:(To|Subject|bcc|reply\-to:)\:.+\r" "&" "-Og" //Add the quotes to all beginnings of lines other than those //marked in red. Put all quoted text in “Ignore Spelling” style. Replace All "^\(Subject\:\s\)\(\(re\:\s*\s*\)*\(re;*\-\s*\s*\)*\)*" "\1Re-" "gt-O" Replace All "^.+" ">&" "g-o-Ot" //Put in the saved attribution information (in green) Find/Replace "\(\r\r\)" "\1\CC\C3\r" "-o-OSAi-wt-Gg" Jump "1" 0 Find Next "^." "gt-o" Key Key Key Key Jump "1" //Pickup and copy the Cc addresses to Clipboard 4 Find Next "^cc\:\(.+\)" "gt" Copy "4" '\1' //Change to clipboard 3 and clear it 3 Clipboard = "" //First pick-up any attachment information, if there to clip 3. Find Next "X\-Attached\:.*\:\([^:]+\)$" "gt" if (Not(NumFound)) GoTo AttachBypass Copy "3" ' and attached the file "\1"\r' AttachBypass: //First, remove detailed headers which are now at the end. Jump "1" Replace All "^____________________Remaining Header Details____________________:.+" "" "-o-OSAi-wt-Gg" //Then, collect Attribution information on Clipboard 1. //Switch to Clipboard 1 1 //Set clipboard to text in case there is no date field //then then get the date, if it’s there. Clipboard = "On an unknown date " Find Next "^Date\:\(.*\)$" "oOSAi©-wt-Gg" //If no date field by-pass getting it. if (Not(NumFound)) GoTo NoDateBypass Copy "" 'On \1 ' //Now remove the date field. Jump "1" Find/Replace "^Date\:.+\r" "" "oOSAi©-wt-Gg" NoDateBypass: //Get the from field. Jump "1" Find Next "^From\:\s*\([^<>@]+\)[^\s\t]+\s*$" "oO-S-Ai-wt-Gg" if (Not(NumFound)) GoTo NoFromBypass Copy "" '\1 wrote to ' GoTo FromAdded NoFromBypass: Clipboard = Clipboard + "someone wrote to " FromAdded: Jump "1" Find Next "^To\:\s\(.+\)" "oO-S-Ai-wt-Gg" Copy "" '\1' //Remove the old “to” Jump "1" Find/Replace "^To\:.+\r" "" "oO-S-Ai-wt-Gg" Jump "1" //ReplyTo Pickup if it exists Find Next "^Reply\s-\--\s-to\:\(.+\)" "oO-S-Ai-wt-Gg" If (Not(NumFound)) GoTo NoReplyField //Copy Reply-to field to clipboard 2 Copy "2" 'To\: \1' //Remove the Reply To field Jump "1" Find/Replace "^Reply\s-\--\s-to\:\(.+\)\r" "" "oO-S-Ai-wt-Gg" Jump "1" Paste "2" //Change to clipboard 4 for the cc address If (Clipboard == "") GoTo NoCc //Add a comma Key , //Paste the cc addresses followed by aa return Paste "4" NoCc: Key CcAdded: 1 //Remove the From field Find/Replace "^From\:.+\r" "" "oO-S-Ai-wt-Gg" GoTo Bypass NoReplyField: //Then, switch “from” to “to” and add the CC addresss //in clipboard 4 Find/Replace "^From\:\s*" 'To: \C4, ' "gt" if (NumFound) GoTo Bypass :1 "There seems to be no return address." Bypass: //Then “cc” removed Find/Replace "^cc\:.+\r" "" "gt" Select All //Make sure all text color is black. Black Replace All "^:(To|Subject|bcc|reply\-to:)\:.+\r" "&" "-Og" //Add the quotes to all beginnings of lines other than those //marked in red. Put all quoted text in “Ignore Spelling” style. Replace All "^\(Subject\:\s\)\(\(re\:\s*\s*\)*\(re;*\-\s*\s*\)*\)*" "\1Re-" "gt-O" Replace All "^.+" ">&" "g-o-Ot" //Put in the saved attribution information (in green) Find/Replace "\(\r\r\)" "\1\CC\C3\r" "-o-OSAi-wt-Gg" Jump "1" 0 Find Next "^." "gt-o" Key Key //Before using this macro, you must change the //red text “Your Hard Drive Name” to the actual //name of your hard drive. //========================= //Change the text in red below to //the name of your hard drive. Save As "Your Hard Drive Name:Desktop Folder:Temp" //Before using you must edit the text in red in this //macro to reflect the path to your Dispatch //folder. //=========================== //The “Send On Save” Macro //When the red text in this macro is adjusted to reflect //your particular path to the Dispatch folder, inside //the Nisus Email Program folder, this macro will save //the current file in the Dispatch folder, causing its //contents to be sent as a message. //Convert all variables to text Select All Variables to Text //Replace All smart quotes with dumb ones. //Remember that in this macro replace expression, //quotes inside quotes must be doubled Replace All "“|”" """" "gt" Replace All "‘|’" "'" "gt" //Start at beginning Jump "1" //If subject field present, pick it up. Find Next "^Subject\::b*\(....+\)$" "gt" //If not found continue, else assign file name. If (NumFound) GoTo NameFile //Now find the To: field, if it exists, to avoid //using it as file name. Find Next "^To\:" "tg" //Now find, without wrap, the first longer //piece of text and mark as file name. Find Next "^\(...............:*:b\)......................" "gt-W" If (NumFound) GoTo NameFile //If still no name, assign default //name to Clip 9. 9 Clipboard = "Email File w/o name" 0 //Now we have a name! Save the file. NameFile: //If nothing was found, jump over the Copy //command - can't copy wht's not found. If (Not(NumFound)) GoTo SaveFile Copy "9" '\1' SaveFile: 9 Clipboard = Clipboard/":" 0 //Change the text in red to make the path //to your dispatch folder correct Save As 'Your Disk Name:Desktop Folder:Nisus Email Folder:Dispatch:\C9' close //You must customize this macro before you can use it. //Change the text in red “Path To Folder” to the //path of the folder where you want the email files saved. //================================ //This macro splits into individual files, a single file //containing any number of emails,, separated by //explicit page breaks. //Start at the beginning Jump "1" loop: //Find (and select) any sequence of characters //that does not include a page break “\f” Find Next "\(:[^\f]+\)" "oO-Wt-GgT" //Use clipboard 1, to preserve the current clipbaord //assuming it is not clipbaord 1, being nice to the user Copy "1" New Paste "1" //Now in this new file find the “to:” field Find Next "^to\::b*\(....+\)$" "gt" //Copy address to clipboard 1 Copy "1" '\1' //Save the new file using the name of the recipient //which is in clipbaord 1 Save As 'Path To Folder:\C1' close goto loop